<?php
ob_start();
$id=$_GET['g_id'];
if(file_exists("info/$id.html"))
{
    echo "这是静态页面";
    include "info/$id.html";
    die;
}
$dbh = new PDO('mysql:host=127.0.0.1;dbname=1705php', 'root', 'root');
$sql="select * from games where g_id=$id";
$res=$dbh->query($sql);
$data=$res->fetch(2);
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<table>
    <tr>
        <td>名称</td>
        <td><?php  echo  $data['g_name']?></td>
    </tr>
    <tr>
        <td>内容</td>
        <td><?php echo $data['g_desc']?></td>
    </tr>
    <tr>
        <td>作者</td>
        <td><?php echo $data['g_autho']?></td>
    </tr>
</table>
</body>
</html>
<?php
file_put_contents("info/$id.html",ob_get_contents());


?>
